/*---------------------------------------------------------------
 * Confidential and Proprietary
 * Copyright 2006 CMO & Hewlett-Packard Development Company, L.P.
 * All Rights Reserved
 * 
 * Project Name    : MPS
 * Sub Project Name: MPS
 *
 * File Name       : ColorTest.java
 *
 * Modification Log:
 *   Date          Ver.#      By            Description
 *   Jan 17, 2007       1.0       haoc        Created
 *---------------------------------------------------------------
 */
package com.erdos.common.util;

import java.io.BufferedOutputStream;
import java.io.File;
import java.io.FileOutputStream;
import java.io.OutputStream;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.Iterator;
import java.util.List;
import java.util.Map;
import java.util.Set;

import javax.swing.table.DefaultTableModel;

import org.apache.poi.hssf.util.HSSFColor;

//TODO ADD Class/Interface DESCRIPTION  BELOW
/**
 * <p>ColorTest is for <!--ADD DESCRIPTION  HERE--></p>
 * @version     1.0     <br/>
 * @author      haoc    
 */
public class ExcelColorTest {
	@SuppressWarnings("unchecked")
    public static void main(String[] args) {
        try {
            FileOutputStream writer = new FileOutputStream(new File("C:\\a.xls"));
            OutputStream ot = new BufferedOutputStream(writer);
            DefaultTableModel[] sheets = new DefaultTableModel[1];
            DefaultTableModel[] colorData = new DefaultTableModel[1];
            sheets[0] = new DefaultTableModel();
            colorData[0] = new DefaultTableModel();
            Set colors = getMap().keySet();
            sheets[0].setRowCount(colors.size()+10);
            sheets[0].setColumnCount(2);
            colorData[0].setRowCount(colors.size()+10);
            colorData[0].setColumnCount(2);
            Iterator itr = colors.iterator();
            int x = 0;
            while(itr.hasNext()){
                Object color = itr.next();
                sheets[0].setValueAt(color,x,0);
                colorData[0].setValueAt(color,x,1);
                x++;
            }
            ExcelWriter.write(null,ot,new String[]{"test"},sheets,new List[]{new ArrayList()},colorData, true, -1);
        } catch (Exception e) {            
            e.printStackTrace();
        }
    }
	@SuppressWarnings("unchecked")
    private static Map getMap(){
        Map colorMap  = new HashMap();
        colorMap.put("BLACK",new Integer(HSSFColor.BLACK.index));
        colorMap.put("BROWN",new Integer(HSSFColor.BROWN.index));
        colorMap.put("OLIVE_GREEN",new Integer(HSSFColor.OLIVE_GREEN.index));
        colorMap.put("DARK_GREEN",new Integer(HSSFColor.DARK_GREEN.index));
        colorMap.put("DARK_TEAL",new Integer(HSSFColor.DARK_TEAL.index));
        colorMap.put("DARK_BLUE",new Integer(HSSFColor.DARK_BLUE.index));
        colorMap.put("INDIGO",new Integer(HSSFColor.INDIGO.index));
        colorMap.put("GREY_80_PERCENT",new Integer(HSSFColor.GREY_80_PERCENT.index));
        colorMap.put("ORANGE",new Integer(HSSFColor.ORANGE.index));
        colorMap.put("DARK_YELLOW",new Integer(HSSFColor.DARK_YELLOW.index));
        colorMap.put("GREEN",new Integer(HSSFColor.GREEN.index));
        colorMap.put("TEAL",new Integer(HSSFColor.TEAL.index));
        colorMap.put("BLUE",new Integer(HSSFColor.BLUE.index));
        colorMap.put("BLUE_GREY",new Integer(HSSFColor.BLUE_GREY.index));
        colorMap.put("GREY_50_PERCENT",new Integer(HSSFColor.GREY_50_PERCENT.index));
        colorMap.put("RED",new Integer(HSSFColor.RED.index));
        colorMap.put("LIGHT_ORANGE",new Integer(HSSFColor.LIGHT_ORANGE.index));
        colorMap.put("LIME",new Integer(HSSFColor.LIME.index));
        colorMap.put("SEA_GREEN",new Integer(HSSFColor.SEA_GREEN.index));
        colorMap.put("AQUA",new Integer(HSSFColor.AQUA.index));
        colorMap.put("LIGHT_BLUE",new Integer(HSSFColor.LIGHT_BLUE.index));
        colorMap.put("VIOLET",new Integer(HSSFColor.VIOLET.index));
        colorMap.put("GREY_40_PERCENT",new Integer(HSSFColor.GREY_40_PERCENT.index));
        colorMap.put("PINK",new Integer(HSSFColor.PINK.index));
        colorMap.put("GOLD",new Integer(HSSFColor.GOLD.index));
        colorMap.put("YELLOW",new Integer(HSSFColor.YELLOW.index));
        colorMap.put("BRIGHT_GREEN",new Integer(HSSFColor.BRIGHT_GREEN.index));
        colorMap.put("TURQUOISE",new Integer(HSSFColor.TURQUOISE.index));
        colorMap.put("DARK_RED",new Integer(HSSFColor.DARK_RED.index));
        colorMap.put("SKY_BLUE",new Integer(HSSFColor.SKY_BLUE.index));
        colorMap.put("PLUM",new Integer(HSSFColor.PLUM.index));
        colorMap.put("GREY_25_PERCENT",new Integer(HSSFColor.GREY_25_PERCENT.index));
        colorMap.put("ROSE",new Integer(HSSFColor.ROSE.index));
        colorMap.put("LIGHT_YELLOW",new Integer(HSSFColor.LIGHT_YELLOW.index));
        colorMap.put("LIGHT_GREEN",new Integer(HSSFColor.LIGHT_GREEN.index));
        colorMap.put("LIGHT_TURQUOISE",new Integer(HSSFColor.LIGHT_TURQUOISE.index));          
        colorMap.put("PALE_BLUE",new Integer(HSSFColor.PALE_BLUE.index));
        colorMap.put("LAVENDER",new Integer(HSSFColor.LAVENDER.index));
        colorMap.put("WHITE",new Integer(HSSFColor.WHITE.index));
        colorMap.put("CORNFLOWER_BLUE",new Integer(HSSFColor.CORNFLOWER_BLUE.index));
        colorMap.put("LEMON_CHIFFON",new Integer(HSSFColor.LEMON_CHIFFON.index));
        colorMap.put("MAROON",new Integer(HSSFColor.MAROON.index));
        colorMap.put("ORCHID",new Integer(HSSFColor.ORCHID.index));
        colorMap.put("CORAL",new Integer(HSSFColor.CORAL.index));
        colorMap.put("ROYAL_BLUE",new Integer(HSSFColor.ROYAL_BLUE.index));
        colorMap.put("LIGHT_CORNFLOWER_BLUE",new Integer(HSSFColor.LIGHT_CORNFLOWER_BLUE.index));    
        
        return colorMap;
    }
}
